// Python reserved keywords that should not be used as field names
export const PYTHON_RESERVED_KEYWORDS = [
    'False',
    'None',
    'True',
    'and',
    'as',
    'assert',
    'async',
    'await',
    'break',
    'class',
    'continue',
    'def',
    'del',
    'elif',
    'else',
    'except',
    'finally',
    'for',
    'from',
    'global',
    'if',
    'import',
    'in',
    'is',
    'lambda',
    'nonlocal',
    'not',
    'or',
    'pass',
    'raise',
    'return',
    'try',
    'while',
    'with',
    'yield',
]

// Common Python built-in functions and types that should be avoided
export const PYTHON_BUILTINS = [
    'abs',
    'all',
    'any',
    'bin',
    'bool',
    'bytearray',
    'bytes',
    'callable',
    'chr',
    'classmethod',
    'compile',
    'complex',
    'delattr',
    'dict',
    'dir',
    'divmod',
    'enumerate',
    'eval',
    'exec',
    'filter',
    'float',
    'format',
    'frozenset',
    'getattr',
    'globals',
    'hasattr',
    'hash',
    'help',
    'hex',
    'id',
    'input',
    'int',
    'isinstance',
    'issubclass',
    'iter',
    'len',
    'list',
    'locals',
    'map',
    'max',
    'memoryview',
    'min',
    'next',
    'object',
    'oct',
    'open',
    'ord',
    'pow',
    'print',
    'property',
    'range',
    'repr',
    'reversed',
    'round',
    'set',
    'setattr',
    'slice',
    'sorted',
    'staticmethod',
    'str',
    'sum',
    'super',
    'tuple',
    'type',
    'vars',
    'zip',
]

// All reserved words (keywords + builtins)
export const ALL_RESERVED_WORDS = [...PYTHON_RESERVED_KEYWORDS, ...PYTHON_BUILTINS]

export const isReservedWord = (word: string): boolean => {
    return ALL_RESERVED_WORDS.includes(word)
}

export const validateFieldName = (fieldName: string): string | null => {
    if (isReservedWord(fieldName)) {
        return `"${fieldName}" is a Python reserved word and cannot be used as a field name`
    }

    return null
}
